/**
 * projectName: springboot-mybatis
 * fileName: UserThreadLocal.java
 * packageName: com.zb.api.utils
 * date: 2022-02-21 15:18
 * copyright(c) 2017-2020 xxx公司
 */
package com.zb.api.utils;
/**
 * @version: V1.0
 * @author: fendo
 * @className: UserThreadLocal
 * @packageName: com.zb.api.utils
 * @description:
 * @data: 2022-02-21 15:18
 **/

import com.zb.api.business.entity.UserEntity;

/**
 * @description:
 * @author: User
 * @date: 2022-02-21 15:18
 */
public class UserThreadLocal {
    private static ThreadLocal<UserEntity> userThread = new ThreadLocal<>();

    public static void set(UserEntity user){

        userThread.set(user);
    }

    public static UserEntity get(){

        return userThread.get();
    }

    //防止内存泄漏
    public static void remove(){

        userThread.remove();
    }

}
